﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

public partial class Patient_ShowToPatient : System.Web.UI.Page
{
    protected void LogoutButton_Click(object sender, EventArgs e)
    {
        Session.Abandon();
        FormsAuthentication.SignOut();
        Response.Redirect("~/Default.aspx");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (Request.QueryString["tel"] == null ||
        //    Request.QueryString["code"] == null ||
        //    Request.QueryString["year"] == null)
        //    Response.Redirect("~/Default.aspx");

        //if (!Page.IsPostBack)
        //{
        //    TestResultType1ObjectDataSource.SelectParameters["tel"].DefaultValue =
        //    TestResultType2ObjectDataSource.SelectParameters["tel"].DefaultValue =
        //    Request.QueryString["tel"].ToString();

        //    TestResultType1ObjectDataSource.SelectParameters["year"].DefaultValue =
        //    TestResultType2ObjectDataSource.SelectParameters["year"].DefaultValue =
        //    Request.QueryString["year"].ToString();

        //    TestResultType1ObjectDataSource.SelectParameters["code"].DefaultValue =
        //    TestResultType2ObjectDataSource.SelectParameters["code"].DefaultValue =
        //    Request.QueryString["code"].ToString();
        //}

        if (Request.QueryString["tel"] == null ||
          Request.QueryString["code"] == null ||
          Request.QueryString["year"] == null)
            Response.Redirect("~/Default.aspx");

        if (!Page.IsPostBack)
        {
            TestResultType1ObjectDataSource.SelectParameters["tel"].DefaultValue =
            TestResultType2ObjectDataSource.SelectParameters["tel"].DefaultValue =
            Request.QueryString["tel"].ToString();

            TestResultType1ObjectDataSource.SelectParameters["year"].DefaultValue =
            TestResultType2ObjectDataSource.SelectParameters["year"].DefaultValue =
            Request.QueryString["year"].ToString();

            TestResultType1ObjectDataSource.SelectParameters["code"].DefaultValue =
            TestResultType2ObjectDataSource.SelectParameters["code"].DefaultValue =
            Request.QueryString["code"].ToString();
        }
    }
}